<?php

include "../../lib/start.php";

check_session();
check_permission(ADM_PERM);

$classID = $_GET['id'];

$sel_mat = "SELECT id_materia, materia FROM materie WHERE (id_materia < 12 OR id_materia = 1006) ORDER BY id_materia";
try{
	$res_mat = $db->executeQuery($sel_mat);
} catch (MySQLException $ex){
	$ex->alert();
}

$anno = $_SESSION['__current_year__']->get_ID();

$sel_cdc = "SELECT id_docente, id_materia FROM cdc WHERE id_classe = $classID AND id_anno = $anno ";
try{
	$res_cdc = $db->executeQuery($sel_cdc);
} catch (MySQLException $ex){
		$ex->alert();
}	
$consiglio = array();
while($con = $res_cdc->fetch_assoc()){
    $consiglio[$con['id_materia']] = $con['id_docente'];
}

$sel_classe = "SELECT * FROM classi WHERE id_classe = $classID";
try{
	$res_classe = $db->executeQuery($sel_classe);
} catch (MySQLException $ex){
	$ex->alert();
}
$classe = $res_classe->fetch_assoc();

include "cdc.html.php";

?>